<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    'use strict';
    class A{
      //能写什么东西?
      // 属性. 下面的写法都是在给『类的实例对象』添加成员
      name;
      age;
      type="人";
      test={a: 100, b: 200}
      fn=function(){
        console.log('fn...');
      }
      go = function(){
        console.log('gogogo');
      }
      
      // 方法.  作用: 初始化对象
      constructor(name, age){
        this.name = name;
        this.age = age;
      }

      //声明方法. 成员方法添加到了原型对象身上
      go(){
        console.log('启动, 起飞....');
      }
    }

    //实例化对象
    let ins = new A('张三', 20);

    // console.log(ins);
    ins.go();


    // class A{
    //   fn(){}
    // }

    // let a = new A();

    function test(){
      console.log(this);
    }

    test.call(undefined);

    class B{
      constructor(props){
        // console.log(props);
        this.props = props;
      }
    }

    let b = new B('abc');
    console.log(b);
  </script>
</body>
</html>